import { Injectable } from '@angular/core';
export const GlobalVariable = freezeObject({
  BASE_API_URL: 'http://mzlocker.com/admin/',
  app : {
    name: '共享储物柜',
    version: '1.0',  
    color: {
      primary: '#7266ba',
      info:    '#23b7e5',
      blue: 'rgb(28,99,161)',
      success: '#27c24c',
      warning: '#fad733',
      danger:  '#f05050',
      light:   '#e8eff0',
      dark:    '#3a3f51',
      black:   '#1c2b36'
    },
    settings: {
      themeID: 1,
      navbarHeaderColor: 'bg-dark',
      navbarCollapseColor: 'bg-dark',
      asideColor: 'bg-dark',
      headerFixed: true,
      asideFixed: false,
      asideFolded: false,
      asideDock: false,
      container: false
    }
  }
 
});

//递归冻结对象 [对象和数组都属于'object']
function freezeObject(Obj){
  for(let index in Obj){
    //判断属性是否私有、是否对象或数组、是否已冻结
    if(!Obj.hasOwnProperty(index) || !(typeof Obj[index] === "object") || Object.isFrozen(Obj[index])){
      continue;
    }
    freezeObject(Obj[index]);
  }
  return Object.freeze(Obj);
}
